package com.ejuornal.action;

import javax.annotation.Resource;

import com.ejuornal.bean.PermissionGroup;
import com.ejuornal.service.PermissionGroupService;

public class PermissionGroupAction extends BaseAction<PermissionGroup>{
    private static final long serialVersionUID = -3296301892825916615L;
    private PermissionGroupService permissionGroupService;
    private PermissionGroup  pg;

    public String list() {
        String url = "admin/permissionGroupList";
        pages = permissionGroupService.find((page - 1) * 10, url);
        return SUCCESS;
    }
    
    public String add() {
        permissionGroupService.add(pg);
        return SUCCESS;
    }
    
    public String delete() {
        int pgId = Integer.parseInt(super.getRequest().getParameter("pgId"));
        if(permissionGroupService.delete(pgId) == true) {
            return SUCCESS;
        }
        return ERROR;
    }
    
    public PermissionGroupService getPermissionGroupService() {
        return permissionGroupService;
    }
    @Resource(name="permissionGroupService")
    public void setPermissionGroupService(PermissionGroupService permissionGroupService) {
        this.permissionGroupService = permissionGroupService;
    }
    
    public PermissionGroup getPg() {
        return pg;
    }

    public void setPg(PermissionGroup pg) {
        this.pg = pg;
    }
}
